package com.wf.provider;

import com.wf.entity.PageInfo;
import com.wf.entity.Role;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by yuzhongbo on 2017/5/3.
 */
@Component
@FeignClient("wf-power")
public interface RoleProvider {

    //Operation(value="获取角色列表", notes="根据Role获取角色列表")
    //ImplicitParam(name = "role", value = "Role", required = false, dataType = "Role")
    @LoadBalanced
    @RequestMapping(value = "/role")
    public PageInfo<Role> getAllByPage(@ModelAttribute(value = "role") Role role);

    //Operation(value="获取角色列表", notes="根据Role获取角色列表")
    //ImplicitParam(name = "role", value = "Role", required = false, dataType = "Role")
    @LoadBalanced
    @RequestMapping(value = "/role/getAll")
    public List<Role> getAll(@ModelAttribute(value = "role") Role role);

    //Operation(value="获取角色", notes="根据角色id获取角色")
    //ImplicitParam(name = "id", value = "角色id", required = true, dataType = "String")
    @LoadBalanced
    @RequestMapping(value = "/role/get/{id}")
    public Role get(@PathVariable(value = "id") String id);

    //Operation(value="删除角色", notes="根据角色id删除角色")
    //ImplicitParam(name = "id", value = "角色id", required = true, dataType = "String")
    @LoadBalanced
    @RequestMapping(value = "/role/delete/{id}")
    public ModelMap delete(@PathVariable(value = "id") String id);

    //Operation(value="保存（添加/修改）角色", notes="根据Role创建角色")
    //ImplicitParam(name = "role", value = "角色实体Role", required = true, dataType = "Role")
    @LoadBalanced
    @RequestMapping(value = "/role/save", method = RequestMethod.POST)
    public ModelMap save(@ModelAttribute(value = "role") Role role);

    //Operation(value="获取用户角色", notes="根据用户id获取用户角色")
    //ImplicitParam(name = "id", value = "用户id", required = true, dataType = "String")
    @LoadBalanced
    @RequestMapping(value = "/role/getRolesByUserId/{userId}")
    public List<Role> getRolesByUserId(@PathVariable(value = "userId") String userId);
}
